# coding: utf8
__author__ = 'Tony'

from django.core.management.base import BaseCommand

from umeng_tool.analyse.models import Device
from umeng_tool.analyse.data_clear.device_clear import read_device


class Command(BaseCommand):
    def handle(self, *args, **options):
        devices = read_device()
        Device.objects.all().delete()
        for dinfo in devices:
            device = Device(**dinfo)
            device.save()
